package map
{
	import battle.MapItem;
	
	import flash.display.Bitmap;
	import flash.display.DisplayObject;
	import flash.events.Event;
	
	import loaders.ILoader;
	import loaders.LoaderManager;
	
	import manager.PathManager;
	
	import map.data.Front;
	
	public class MapFrontItem extends MapItem
	{
		private var _mapid:String;
		private var _info:Front;
		private var _bitmap:Bitmap;
		public function MapFrontItem(mapid:String,info:Front)
		{
			super();
			_mapid = mapid;
			_info = info;
		}
		
		override public function loadResource():void
		{
			var loader:ILoader = LoaderManager.Instance.creatLoaderUrl(PathManager.resloveMapBGPath(_mapid,_info.nativePath),onFrontComplete);
			loader.load();
		}
		
		private function onFrontComplete(loader:ILoader):void
		{
			_bitmap = loader.content as Bitmap;
			_bitmap.x = _info.position.x;
			_bitmap.y = _info.position.y;
		}
		
		override public function get view():DisplayObject
		{
			return _bitmap;
		}
	}
}